
import { ONSALES_TIPS_NUM, ONSALES_TIPS_RESET } from '../actions/constants'

import _ from 'lodash'

const initialState = {
  onSalesTipsThreshold: 5,
}

export default (state = initialState, { type, payload }) => {
  const copy = _.cloneDeep(initialState)

  switch (type) {

  case ONSALES_TIPS_NUM:
    copy.onSalesTipsThreshold = payload.num
    return copy

  case   ONSALES_TIPS_RESET:
    copy.onSalesTipsThreshold = 5
    return copy

  default:
    return state
  }
}
